package com.rpay.dao.account;

import com.rpay.model.account.AccountDO;
import com.rpay.model.account.AccountQueryDO;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author XXX
 * @mail XXX@hotmail.com
 * @date 2018/5/14
 * @Description:
 */
@Repository
public class AccountDao {
    @Autowired
    @Qualifier("readSqlSession")
    private SqlSessionTemplate readSqlSession;

    @Autowired
    @Qualifier("writeSqlSession")
    private SqlSessionTemplate writeSqlSession;

    public List<AccountDO> list(AccountQueryDO accountQueryDO) {
        return readSqlSession.selectList("rpay.account.list", accountQueryDO);
    }

    public Integer selectRow(AccountQueryDO accountQueryDO) {
        return readSqlSession.selectOne("rpay.account.selectRow", accountQueryDO);
    }

    public int patch(AccountDO accountDO) {
        return writeSqlSession.update("rpay.account.patch", accountDO);
    }
}
